<template>
	<view style="height: 100%;">

		<view class="bg-white padding-sm">
			<!--顶部个人信息栏-->
			<view class="header-section ">
				<view class="flex padding-sm justify-between bg-white radius">
					<view class="flex align-center ">

						<image @click="updatePhoneImage" style="" :src="user.avatar||'/static/images/阳小妹.png'"
							class="cu-avatar xl round" mode="widthFix">
						</image>
						<view class="margin-left-xs font-title ">
							<view v-if="!user.realName" @click="handleToLogin" class="login-tip ">
								点击登录
								<view v-if="!user.realName" @click="handleToLogin"
									class=" font-content margin-top-sm font-content">
									请先登录
								</view>
							</view>

							<view v-if="user.realName" @click="handleToInfo" class="user-info action-item">
								<view class="u_title">
									{{ user.realName||'未登录' }}
								</view>
								<view class="u_title font-13" style="font-size: 28rpx;" @tap.stop="updatePhoneImage">
									{{ user.mobile||'未设置手机号' }}
								</view>
							</view>
						</view>
					</view>
					<view @click="handleToInfo" class="flex align-center text-black" v-if="avatar">
						<text>个人信息</text>
						<view class="iconfont icon-right"></view>
					</view>
				</view>
			</view>

			<view class="bg-pink radius  ">

				<view style="display: flex;">

					<view class="margin-left-sm margin-top-xs" style="width: 100%;">会员卡号:1233456789
						<view class="flex margin-top">

							<view style="flex: 1;">
								<view>
									<view class=" font-23">0</view>
									<view class=" margin-top-xs">
										优惠卷
										<uni-icons type="right" size="14" color="#fff"></uni-icons>
									</view>
								</view>

							</view>
							<view style="flex: 1;" @click="recharge">
								<view class=" font-23">0</view>
								<view class="  margin-top-xs">余额<uni-icons type="right" size="14"
										color="#fff"></uni-icons>
								</view>
							</view>

						</view>
					</view>
					<view style="">
						<image style=" width: 200rpx;height: 200rpx;" src="@/static/images/胜利.png">
						</image>
					</view>
				</view>
			</view>
		</view>
		<view class="mine-container  " style="height100%;position: relative;z-index: 2;padding: 20rpx;">

			<!-- <view class="radius margin-top-sm">
				<uni-notice-bar single show-icon scrollable text="是 NoticeBar 通告栏，这是 NoticeBar 通告栏"></uni-notice-bar>
			</view> -->

			<view class="radius margin-top-xs bg-white ">
				<uni-swiper-dot :info="info" :current="swiperDotIndex" class="radius">
					<swiper autoplay :interval="2000" class="swiper-box radius" @change="change" style="height: 200rpx;"
						:current="swiperDotIndex">
						<swiper-item v-for="(item, index) in info" :key="index" class="radius">
							<image style="width: 100%;height: 100%;border-radius: 20rpx;" class="radius"
								:src="item.url"></image>
						</swiper-item>
					</swiper>
				</uni-swiper-dot>
			</view>

			<view class="content-section margin-top-sm">
				<view class="mine-actions grid col-4 text-center">
					<view class="action-item" @click="handleJiaoLiuQun">
						<view class="iconfont icon-friendfill text-pink icon itemCorlo padding-xs radius juzhong"
							style="color: #fff;width: 80rpx;height: 80rpx;">
						</view>
						<text class="text">我的订单</text>
					</view>
					<view class="action-item" @click="handleBuilding">
						<view class="iconfont icon-service text-blue icon itemCorlo padding-xs radius juzhong"
							style="color: #fff;width: 80rpx;height: 80rpx;">
						</view>
						<text class="text">关于我们</text>
					</view>
					<view class="action-item" @click="handleBuilding">
						<view class="iconfont icon-community text-mauve icon itemCorlo padding-xs radius juzhong"
							style="color: #fff;width: 80rpx;height: 80rpx;"></view>
						<text class="text">更多设置</text>
					</view>
					<view class="action-item " @click="handleBuilding">
						<view class="iconfont icon-dianzan text-green icon itemCorlo padding-xs radius juzhong"
							style="color: #fff;width: 80rpx;height: 80rpx;">
						</view>
						<text class="text">点赞我们</text>
					</view>
					<view class="action-item margin-top-sm" @click="handleBuilding">
						<view class="iconfont icon-dianzan text-green icon itemCorlo padding-xs radius juzhong"
							style="color: #fff;width: 80rpx;height: 80rpx;">
						</view>
						<text class="text">点赞我们</text>
					</view>
					<view class="action-item margin-top-sm" @click="handleLogout">
						<view class="iconfont icon-dianzan text-green icon itemCorlo padding-xs radius juzhong"
							style="color: #fff;width: 80rpx;height: 80rpx;">
						</view>
						<text class="text">退出登录</text>
					</view>
				</view>





			</view>
			<guaguaLxianxi></guaguaLxianxi>
		</view>
		<!-- <Tabbar :pageIndex="3"></Tabbar> -->

		<updatePhoneImage ref="updatePhoneImage"></updatePhoneImage>
	</view>
</template>

<script>
	import storage from '@/utils/storage'

	import {
		isNull
	} from "@/utils/validate";
	import {
		getcommon,
		setcommon,
		clear
	} from "@/utils/common";

	export default {
		components: {

		},
		data() {
			return {

				version: getApp().globalData.config.appInfo.version,
				avatar: null,
				windowHeight: null,
				user: null,
				tenantId: null,
				swiperDotIndex: 0,
				info: [{
					url: '/static/images/IMG_202409031370_572x181.jpg',

				}, {
					url: '/static/images/IMG_202409031370_572x181.jpg',
					url: '/static/images/IMG_202409031370_572x181.jpg',
				}],
			}
		},
		computed: {

		},
		onShow() {
			this.init()
		},

		methods: {

			updatePhoneImage() {
				this.$refs.updatePhoneImage.open()
			},
			change(e) {

			},
			recharge() {
				uni.navigateTo({
					url: "/pages/mine/recharge/recharge"
				})
			},
			init() {

				this.user = this.$store.state.user.user
				if (isNull(this.user.avatar)) {
					this.user.avatar = "/static/images/阳小妹.png"
				}
				this.windowHeight = uni.getSystemInfoSync().windowHeight - 50

			},
			handleToInfo() {
				this.$tab.navigateTo('/pages/mine/info/index')
			},
			handleToEditInfo() {
				this.$tab.navigateTo('/pages/mine/info/edit')
			},
			handleToSetting() {
				this.$tab.navigateTo('/pages/mine/setting/index')
			},
			handleToLogin() {
				this.$tab.reLaunch('/pages/login')
			},
			handleToAvatar() {
				this.$tab.navigateTo('/pages/mine/avatar/index')
			},

			handleHelp() {
				this.$tab.navigateTo('/pages/mine/help/index')
			},
			handleAbout() {
				this.$tab.navigateTo('/pages/mine/about/index')
			},
			handleJiaoLiuQun() {
				this.$modal.showToast('11111111111111')
			},
			handleBuilding() {
				this.$modal.showToast('模块建设中~')
			},
			handleToPwd() {
				this.$tab.navigateTo('/pages/mine/pwd/index')
			},
			handleToUpgrade() {
				this.$modal.showToast('模块建设中~')
			},
			handleCleanTmp() {
				this.$modal.showToast('模块建设中~')
			},
			handleLogout() {
				this.$modal.confirm('确定注销并退出系统吗？').then(() => {

					this.$store.dispatch('LogOut').then(() => {

						this.$clearDictList()
						clear()
						this.$tab.reLaunch('/pages/index')

					})
				})
			},
			async selectTenant() {
				this.$refs.selectTenant.open()

			},
		}
	}
</script>

<style lang="scss">
	page {
		height: 100%;
		background: linear-gradient(to bottom, #f0f4f8, #ffffff);
	}

	.itemCorlo {
		background-color: #ff6f61;
	}

	.primaryFontColor {
		color: #ff6f61;
	}

	.user-info {
		margin-left: 15rpx;

		.u_title {
			font-size: 32rpx;
			line-height: 50rpx;
			color: #555;
		}
	}

	.mine-container {
		width: 100%;
		height: 100%;
		margin-bottom: 0rpx;
		color: #000;

		.header-section {
			.login-tip {
				font-size: 18px;
				margin-left: 10px;
				color: #333;
			}

			.cu-avatar {
				border: 2px solid #eaeaea;
				border-radius: 50%;

				.icon {
					font-size: 40px;
				}
			}


		}

		.content-section {
			position: relative;

			.mine-actions {
				padding: 40rpx 0px;
				border-radius: 8px;
				// background-color: white;
				// box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);

				.action-item {
					.icon {
						font-size: 28px;
					}

					.text {
						display: block;
						font-size: 13px;
						margin-top: 10rpx;
						color: #666;
					}
				}
			}
		}
	}

	.top1 {
		position: fixed;
		z-index: 1;
		top: 0;
		left: 0;
		right: 0;
	}
</style>